package ejb;

import Entities.Mesa;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

@Stateless
public class MesaFacade extends FacadeAbstracto<Mesa> implements MesaFacadeLocal {

    @PersistenceContext(unitName = "SGR-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public MesaFacade() {
        super(Mesa.class);
    }

    @Override
    public List<Mesa> buscarMesas(int maximo) {
        Query q = em.createNamedQuery("todasMesas");
        //Query q = em.createQuery("Select m from Mesa  m;");
        //q.setParameter("maximo", maximo);
        List<Mesa> listaMeasa = q.getResultList();
        return listaMeasa;
    }
    
}
